﻿


using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;

namespace EFCore
{
    public class CoreDbContext : DbContext
    {
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                optionsBuilder.UseMySql("Data Source=127.0.0.1; port=3306;database=netcoretest;uid=root;pwd=123456;SslMode=none;Allow User Variables=True");
            }
        }

        /// <summary>
        /// 组织
        /// </summary>
        public DbSet<GroupModel> Group { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.ApplyConfiguration(new GroupMap());//应用设置
            base.OnModelCreating(modelBuilder);
        }
    }
}
